package warmachineroster.grapheditor.editpart;

import java.util.List;

import org.eclipse.draw2d.IFigure;
import org.eclipse.gef.EditPolicy;

import warmachineroster.WarcasterRosterElement;
import warmachineroster.WarjackRosterElement;
import warmachineroster.grapheditor.figure.WarcasterRosterElementFigure;
import warmachineroster.grapheditor.policy.RosterElementComponentEditPolicy;
import warmachineroster.grapheditor.policy.WarcasterFlowLayoutEditPolicy;

public class WarcasterRosterElementEditPart extends RosterElementEditPart {



	@Override
	protected IFigure createFigure() {
		WarcasterRosterElementFigure figure = new WarcasterRosterElementFigure(getElementName(), getUnitType().getArmyList().getCode());
		return figure;
	}

	@Override
	protected void createEditPolicies() {
		installEditPolicy(EditPolicy.LAYOUT_ROLE, new WarcasterFlowLayoutEditPolicy());
		installEditPolicy(EditPolicy.COMPONENT_ROLE, new RosterElementComponentEditPolicy());

	}

	@Override
	protected List<WarjackRosterElement> getModelChildren() {
		return getWarcasterRosterElement().getBattlegroup();
	}

	public WarcasterRosterElement getWarcasterRosterElement(){
		return (WarcasterRosterElement) getModel();
	}
	
	@Override
	protected void refreshVisuals(){
		super.refreshVisuals();
	}

	@Override
	public IFigure getContentPane() {
		return getWarcasterRosterElementFigure().getBattleGroupFigure();
	}
	
	protected WarcasterRosterElementFigure getWarcasterRosterElementFigure(){
		return((WarcasterRosterElementFigure)getFigure());
	}
	

	
}
